
#ifndef __RSA_KEYPAIR_GENERATOR_H
#define __RSA_KEYPAIR_GENERATOR_H

#include "RSAPublicKey.h"
#include "RSAPrivateKey.h"

/** An RSA key pair generator. */
class RSAKeyPairGenerator
{
   public:
      RSAKeyPairGenerator(int nbits, const char *name);
      RSAKeyPairGenerator(const RSAKeyPairGenerator &o);
      RSAKeyPairGenerator &operator=(const RSAKeyPairGenerator &o);
      ~RSAKeyPairGenerator();
      int checkAreKeyPair();
      static int checkAreKeyPair(RSAPublicKey *ipub, RSAPrivateKey *iprv);
      RSAPublicKey *getPublicKey();
      RSAPrivateKey *getPrivateKey();
      RSAPublicKey *popPublicKey();
      RSAPrivateKey *popPrivateKey();
   private:
      /** Generate key pair into the RSAPublicKey and RSAPrivateKey
       * classes. */
      int generateKeyPair(int nbits, const char *name);
      /** Pointer to the RSA public key. */
      RSAPublicKey *pub;
      /** Pointer to the RSA private key. */
      RSAPrivateKey *prv;
};

#endif
